package server

import (
	"context"

	"starsine.cn/appTpl/svclog/peers/svclogproto"
	"starsine.cn/appTpl/svclog/src/logproc"
	. "starsine.cn/appTpl/svclog/src/logproc/defs"
)

type SvcLogServer struct {
	svclogproto.UnimplementedSvcLogProtoServer
}

func (p *SvcLogServer) SXXX(ctx context.Context, in *svclogproto.SXXXReq) (*svclogproto.SXXXRes, error) {
	return &svclogproto.SXXXRes{}, nil
}

func (p *SvcLogServer) WriteLog(ctx context.Context, in *svclogproto.WriteLogReq) (*svclogproto.Res, error) {
	logproc.GetLogBuff().In(LogLine{
		InstanceID: in.InstanceID,
		Data:       in.Data,
	})

	return &svclogproto.Res{
		Succ: true,
	}, nil
}
